package ru.papergames.battleserver.model.battle.npc;

import ru.papergames.battleserver.model.battle.BallColor;

/**
 * @author Alexander Troshanin
 */
public class NpcBall {

    private final BallColor color;
    private NpcCell cell;

    private NpcLine lineAlpha0;
    private NpcLine lineAlpha45;
    private NpcLine lineAlpha90;
    private NpcLine lineAlpha135;

    private boolean blocked;

    public NpcBall(BallColor color) {
        this.color = color;
    }

    public BallColor getColor() {
        return color;
    }

    public NpcCell getCell() {
        return cell;
    }

    public void setCell(NpcCell cell) {
        this.cell = cell;
    }

    public boolean isBlocked() {
        return blocked;
    }

    public void setBlocked(boolean blocked) {
        this.blocked = blocked;
    }

    public NpcLine getLine(LineVector vector) {
        switch (vector) {
            case ALPHA_0:
                return lineAlpha0;
            case ALPHA_45:
                return lineAlpha45;
            case ALPHA_90:
                return lineAlpha90;
            case ALPHA_135:
                return lineAlpha135;
        }
        return null;
    }

    public void setLine(NpcLine line) {
        switch (line.getVector()) {
            case ALPHA_0:
                lineAlpha0 = line;
                break;
            case ALPHA_45:
                lineAlpha45 = line;
                break;
            case ALPHA_90:
                lineAlpha90 = line;
                break;
            case ALPHA_135:
                lineAlpha135 = line;
                break;
        }
    }

    public void removeLine(LineVector vector) {
        switch (vector) {
            case ALPHA_0:
                lineAlpha0 = null;
                break;
            case ALPHA_45:
                lineAlpha45 = null;
                break;
            case ALPHA_90:
                lineAlpha90 = null;
                break;
            case ALPHA_135:
                lineAlpha135 = null;
                break;
        }
    }
}
